Method and apparatus for reducing service impairment in link aggregation group

ABSTRACT

A method and apparatus for reducing service impairment in a LAG are provided. The method includes: dividing a service packet into multiple service sub-flows, and allocating the multiple service sub-flows to all the physical ports averagely; after a new port is added, configuring a preset quantity of service sub-flows for the new port; or, after a port is deleted, allocating the service sub-flows on the deleted port to other ports; and finding a forwarding physical port through a service packet according to the service sub-flows. An apparatus for reducing service impairment in a LAG includes: an initializing module, a new port processing module or a deleted port processing module, and a forwarding port search module. In the case of adding or deleting a port, only the affected service sub-flows are operated, thus minimizing the impact.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Application No.PCT/CN2008/000155 filed Jan. 22, 2008, entitled “Method and Apparatusfor Reducing Service Loss in a Link Aggregation Group,” which claimspriority to the Chinese Patent Application No. 200710001192.8 entitled“Method and Apparatus for Reducing Service Impairment in LinkAggregation Group” filed with the Chinese Patent Office on Jan. 22,2007, the entire content of both of which are incorporated herein byreference in their entirety.

TECHNICAL FIELD

The disclosed embodiments relate to network communication, and inparticular, to a method and apparatus for reducing service impairment ina Link Aggregation Group (LAG).

BACKGROUND

Link aggregation refers to aggregating multiple ports together to form aLAG. FIG. 1 shows a LAG with two ports, where a service packet may betransferred through different ports and the bandwidth is allocatedaveragely among the ports. Therefore, the bandwidth increases linearly.

Once the port state changes, the ports in the LAG increase or decreaseaccordingly, and the packet may reselect a sending port. When the packetreselects the sending port, no selection algorithm is defined clearly inthe prior art, and the implementation method varies betweenmanufacturers. Generally, the service packets are redistributedaccording to the current quantity of ports. Consequently, the serviceson all the ports are disrupted or the service packets are disordered.Some services originally not vulnerable to impact may also change thebearer port, and the services are affected excessively.

SUMMARY

In order to relieve impairment of the services in link aggregation inthe prior art in the case of adding or deleting physical ports, a methodand apparatus for reducing service impairment in a LAG are providedconsistent with some embodiments.

A method for reducing service impairment in a LAG includes:

-   -   dividing a service packet into multiple service sub-flows, and        allocating the multiple service sub-flows to physical ports        averagely;    -   reallocating the service sub-flows consecutively until the        quantity of the service sub-flows on each physical port is        equalized when the quantity of ports changes; and    -   finding, by a service packet, a corresponding forwarding        physical port according to the service sub-flow.

An apparatus for reducing service impairment in a LAG is provided. Theapparatus may include:

-   -   an initializing module, adapted to: divide a service packet into        multiple service sub-flows, and allocate the multiple service        sub-flows to physical ports averagely;    -   a port processing module, adapted to reallocate the service        sub-flows consecutively until the quantity of the service        sub-flows on each physical port is equalized when the quantity        of ports changes; and    -   a forwarding port search module, adapted for a service packet to        find a corresponding forwarding physical port according to the        service sub-flow.

The technical solution under the embodiments brings the followingbenefits:

-   -   Consistent with some embodiments, a service packet is divided        into multiple service sub-flows, and the service sub-flows are        allocated to all physical ports in a LAG averagely. Once a        physical port is added or deleted from the LAG, the affected        service sub-flows may be operated, and the service packet        searches for the port of forwarding the packet according to the        service sub-flow, thus minimizing the impact on the service.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows a structure of a LAG in the prior art;

FIG. 2 shows corresponding relations between a service sub-flow and aphysical port according to a first embodiment;

FIG. 3 is a flowchart of a method for reducing service impairment in aLAG according to the first embodiment;

FIG. 4 shows a result of configuring service sub-flows for a new portaccording to the first embodiment;

FIG. 5 shows an apparatus for reducing service impairment in a LAGaccording to a second embodiment;

FIG. 6 is a flowchart of a method for reducing service impairment in aLAG according to a third embodiment; and

FIG. 7 shows an apparatus for reducing service impairment in a LAGaccording to a fourth embodiment.

DETAILED DESCRIPTION

The disclosed embodiments are hereinafter described in detail withreference to exemplary embodiments and accompanying drawings, but thedisclosed embodiments are not limited to the following embodiments.

In the disclosed embodiments, a service packet is divided into multipleservice sub-flows, the service sub-flows are allocated to differentphysical ports averagely, and the service packet is sent out through thephysical port corresponding to the service sub-flow. If the state of thephysical port changes, namely, if a physical port needs to be added intoor deleted from a LAG, the corresponding relation between the affectedservice sub-flow and the physical port may be modified.

A service packet corresponds to multiple service sub-flows according tothe distribution algorithm. The distribution algorithm distributes theservice sub-flows according to the destination MAC address field, sourceMAC address field or combination thereof in the Ethernet packet, or inother modes. The disclosed embodiments do not deal with the specificdistribution algorithm.

EMBODIMENT 1

In the initialization, one physical port is set in the LAG, and allservice sub-flows are correlated with the physical port. After morephysical ports are added, the corresponding relation between thephysical port and the service sub-flow is shown in Table 1. If the totalnumber of physical ports is n−(m% n), each port corresponds to m/nservice sub-flows, where m% n means m modulus divided by n, and theresult of m% n is the remainder of m divided by n. Moreover, among them% n physical ports, each port corresponds to (m/n)+1 service sub-flows.In order to allocate the service packets among the ports evenly, thequantity of service sub-flows corresponding to one group of ports is onemore or less than the quantity of service sub-flows corresponding to theother group of ports in this embodiment, which also applies to adding ordeleting a physical port subsequently. However, such an allocationrelation is not necessary, and it is also possible that the quantity ofservice sub-flows corresponding to one group of ports is over one moreor less than the quantity of service sub-flows corresponding to theother group of ports.

TABLE 1 Quantity of service Quantity of sub-flows physical ports m/n n −(m % n) (m/n) + 1 m % n

Example: As shown in FIG. 2, the service packet on the first NetworkElement (NE1) and the second NE (NE2) may be divided into four servicesub-flows: D1, D2, D3, and D4; and two physical ports P1 and P2 exist ina LAG. According to the corresponding relations in Table 1, if thequantity of service sub-flows is: 4/2=2, the quantity of physical portsis: 2−(4% 2)=2; if the quantity of service sub-flows is (4/2)+1=3, thequantity of physical ports is: 4% 2=0.

Therefore, the corresponding relation between the service sub-flow andthe physical port is as follows:

Each physical port has two service sub-flows. That is, service sub-flowsD1 and D2 shown in FIG. 2 correspond to the physical port P1, andservice sub-flows D3 and D4 correspond to the physical port P2.

After one port is added (only one port can be added at a time), thecorresponding relation between each port and each service sub-flow isshown in Table 2:

TABLE 2 Quantity of service Quantity of sub-flows physical portsm/(n + 1) (n + 1) − (m %(n + 1)) (m/(n + 1)) + 1 m %(n + 1)

When a physical port is added in the LAG, the change of the existingcorresponding relation between the physical port and the servicesub-flow may be the minimum. The allocation begins with the port whichcontains many service sub-flows.

FIG. 3 shows a method for reducing service impairment in a LAG accordingto some embodiments. The method includes:

Step 101: The quantity of service sub-flows in the existing physicalport is checked.

Step 102: A port is selected consecutively in a group of ports whichcontain many service sub-flows; a service sub-flow on the selected portis allocated to a newly added port; it is checked whether the quantityof service sub-flows in the newly added port reaches m/(n+1) every timeafter a service sub-flow is added; if the quantity of service sub-flowsin the newly added port reaches m/(n+1) every time after a servicesub-flow is added, the process is ended; otherwise, the process proceedsto step 103.

Step 103: It is judged whether the group of ports is traversed; and ifthe group of ports is traversed, the process proceeds to step 104;otherwise, the process returns to step 102.

Step 104: A service sub-flow is selected consecutively in a group ofports which have few service sub-flows, and the service sub-flow isallocated to the newly added port; if the quantity of the servicesub-flows in the newly added port reaches m/(n+1), the process is ended;otherwise, the process proceeds to step 105.

Step 105: It is judged whether the group of ports is traversed; if thegroup of ports is traversed, the process proceeds to step 102;otherwise, the process returns to step 104.

After the service sub-flows are allocated, the service packet finds thecorresponding forwarding physical port according to the service sub-flowso as to forward the packet.

Example: Taking the LAG in FIG. 2 as an example, a port P3 is added inthe LAG. Both the quantity of service sub-flows on P1 and the quantityof service sub-flows on P2 are 2, and 4% 2 is 0. Therefore, step 103 isperformed, and a service sub-flow is removed from P1 first. At thistime, the quantity of service sub-flows on P3 is 4/(2+1)=1, and theprocess is ended. The final result is shown in FIG. 4: P1 contains oneservice sub-flow (D2), P2 contains two service sub-flows (D3 and D4),and P3 contains one service sub-flow (D1).

EMBODIMENT 2

As shown in FIG. 5, an apparatus for reducing service impairment in aLAG in the second embodiment. The method may include:

-   -   an initializing module, adapted to: divide a service packet into        multiple service sub-flows, and allocate the multiple service        sub-flows to physical ports averagely;    -   a new port processing module, adapted to: select a physical port        with many service sub-flows consecutively according to the        allocation result of the initializing module after a new        physical port is added, obtain a service sub-flow from the        selected physical port, and allocate the service sub-flow to the        new physical port until the quantity of service sub-flows on the        new physical port reaches the preset quantity; and    -   a forwarding port search module, adapted for a service packet to        find the corresponding forwarding physical port according to the        service sub-flow.

After multiple service sub-flows are allocated to the physical portsaveragely, the maximum difference between the quantity of servicesub-flows on one physical port and the quantity of service sub-flows onanother physical port is 1.

If the total number of service sub-flows is m and the total number ofphysical ports is n+1, the preset quantity in a newly added portprocessing module may be an integer value equal to m divided by n+1.

EMBODIMENT 3

After one port is deleted (only one port can be deleted at a time), thecorresponding relation between each physical port and each servicesub-flow is shown in Table 3:

TABLE 3 Quantity of service Quantity of sub-flows physical ports m/(n− 1) (n − 1) − (m %(n − 1)) (m/(n − 1)) + 1 m %(n − 1)

The quantity of service sub-flows released by deleting a port may be m/nor (m/n)+1. As shown in FIG. 6, the released service sub-flows areallocated in the following way:

Step 201: The quantity of service sub-flows in the remaining physicalport after a physical port is deleted is checked.

Step 202: A group of physical ports with few service sub-flows areselected, and the service sub-flows on the deleted physical port areallocated to the selected group of physical ports consecutively, whereone service sub-flow is allocated to each physical port.

Step 203: It is checked whether the quantity of service sub-flows on thedeleted physical port is 0: if the quantity of service sub-flows on thedeleted physical port is 0, the process is ended; otherwise, the processproceeds to step 204.

Step 204: A group of physical ports with many service sub-flows areselected in the remaining physical ports after a physical port isdeleted.

Step 205: The service sub-flows on the deleted physical port areallocated to a newly selected group of physical ports consecutively,where one service sub-flow is allocated to each physical port.

Step 206: It is checked whether the quantity of service sub-flows on thedeleted physical port is 0; the quantity of service sub-flows on thedeleted physical port is 0, the process is ended; otherwise, the processproceeds to step 202.

After the service sub-flows are allocated, the service packet finds thecorresponding forwarding physical port according to the service sub-flowso as to forward the packet.

Example: Taking the LAG shown in FIG. 4 as an example, if the physicalport P1 is deleted from the LAG, the service sub-flow D2 on P1 isallocated to P3; if the physical port P2 is deleted, the servicesub-flows D3 and D4 are allocated to P1 and P3.

EMBODIMENT 4

As shown in FIG. 7, another apparatus for reducing service impairment ina LAG in the fourth embodiment includes:

-   -   an initializing module, adapted to: divide a service packet into        multiple service sub-flows, and allocate the multiple service        sub-flows to physical ports averagely;    -   an deleted port processing module, adapted to allocate the        service sub-flows on the deleted physical port to other physical        ports allocated by the initializing module averagely in a        consecutive way until the quantity of the service sub-flows on        the deleted physical port is 0; and    -   a forwarding port search module, adapted for a service packet to        find the corresponding forwarding physical port according to the        service sub-flow.

After multiple service sub-flows are allocated by the initializingmodule to the physical ports averagely, the maximum difference betweenthe quantity of service sub-flows on one physical port and the quantityof service sub-flows on another physical port is 1.

In the foregoing embodiments, a service packet is divided into multipleservice sub-flows, and all the service sub-flows are allocated to allphysical ports in a LAG averagely. Once a physical port is added ordeleted, the affected service sub-flows may be operated, and the servicepacket searches for the port of forwarding the packet according to theservice sub-flow, thus minimizing the impact on the service.

The traffic remains balanced in the operation process. If the quantityof service sub-flows is higher, the traffic corresponding to eachservice sub-flow is lower, fewer services are affected in the case ofmodifying the corresponding relation between the service sub-flow andthe port, and the equilibrium is better.

Although the embodiments have been described through several preferredembodiments, the disclosed embodiments are not limited to suchembodiments. It is apparent that those skilled in the art can makevarious modifications and variations to the disclosed embodimentswithout departing from the spirit and scope of the disclosure. Thedisclosed embodiments are intended to cover the modifications andvariations provided that they fall in the scope of protection defined bythe following claims or their equivalents.

1. A method for reducing service impairment in a Link Aggregation Group(LAG) comprising: dividing a service packet into multiple servicesub-flows, and allocating the multiple service sub-flows to eachphysical port of a plurality of physical ports averagely; reallocatingthe service sub-flows consecutively until a quantity of the servicesub-flows on each physical port is equalized when a quantity of portschange; and forwarding the service packet, according to thecorresponding physical ports of the service sub-flows.
 2. The method forreducing service impairment in a LAG according to claim 1, wherein:after the multiple service sub-flows are allocated to the physical portsaveragely, a maximum difference between the quantity of the servicesub-flows on one physical port and the quantity of the service sub-flowson another physical port is
 1. 3. The method for reducing serviceimpairment in a LAG according to claim 1, wherein: after a new physicalport is added, selecting an old physical port consecutively, obtainingone service sub-flow among the selected physical ports, and allocatingthe service sub-flow to the new physical port until the quantity of theservice sub-flows is equalized among all the physical ports.
 4. Themethod for reducing service impairment in a LAG according to claim 3,wherein: a total number of the service sub-flows is m, a total number ofthe physical ports is n+1 after the new physical port is added, and thequantity of the service sub-flows allocated to the new physical port isan integer value equal to m divided by n+1.
 5. The method for reducingservice impairment in a LAG according to claim 3, wherein: the quantityof the service sub-flows on one physical port is different from thequantity of the service sub-flows on another physical port; and afterthe new physical port is added, a physical port with many servicesub-flows is selected consecutively, and one service sub-flow isobtained from the selected physical port and allocated to the newphysical port.
 6. The method for reducing service impairment in a LAGaccording to claim 5, wherein: after the new physical port is added, thephysical port with many service sub-flows is selected consecutively, andone service sub-flow is obtained from the selected physical port andallocated to the new physical port, whereupon the quantity of theservice sub-flows are not equalized among all the physical ports; aphysical port with few service sub-flows is selected consecutively, andone service sub-flow is obtained from the selected physical port andallocated to the new physical port; and if the quantity of the servicesub-flows is equalized among all the physical ports, the process isended; if the quantity of the service sub-flows is not equalized amongall the physical ports, the physical port with many service sub-flows isselected consecutively again, and one service sub-flow is obtained fromthe selected physical port and allocated to the new physical port. 7.The method for reducing service impairment in a LAG according to claim1, wherein: after a physical port is deleted, service sub-flows on thedeleted physical port are allocated to other physical ports averagely ina consecutive way until a quantity of the service sub-flows on thedeleted physical port is
 0. 8. The method for reducing serviceimpairment in a LAG according to claim 7, wherein: a quantity of theservice sub-flows on one physical port is different from a quantity ofthe service sub-flows on another physical port; and after one physicalport is deleted, service sub-flows on the deleted physical port areallocated to a physical port with few service sub-flows consecutively.9. The method for reducing service impairment in a LAG according toclaim 8, wherein: after the physical port is deleted, the servicesub-flows on the deleted physical port are allocated to the physicalport with few service sub-flows consecutively, whereupon the quantity ofthe service sub-flows on the deleted physical port is not 0; the servicesub-flows on the deleted physical port are allocated to a physical portwith many service sub-flows consecutively, and, if the quantity of theservice sub-flows on the deleted physical port is 0, the process isended, if the quantity of the service sub-flows on the deleted physicalport is not 0, the service sub-flows on the deleted physical port areallocated to the physical port with few service sub-flows consecutivelyagain.
 10. An apparatus for reducing service impairment in a LinkAggregation Group (LAG) comprising: an initializing module, adapted todivide a service packet into multiple service sub-flows, and allocatethe multiple service sub-flows to all physical ports averagely; a portprocessing module, adapted to reallocate the service sub-flowsconsecutively until a quantity of the service sub-flows on each physicalport is equalized when a quantity of ports changes; and a forwardingport search module, adapted for the service packet to find acorresponding forwarding physical port according to the servicesub-flows.
 11. The apparatus for reducing service impairment in a LAGaccording to claim 10, wherein: the initializing module, is furtheradapted to: divide the service packet into multiple service sub-flows,and allocate the multiple service sub-flows to all the physical portsaveragely; and the port processing module comprises a new portprocessing module, adapted to: select a physical port with many servicesub-flows consecutively according to an allocation result of theinitializing module after a new physical port is added, obtain a servicesub-flow from the selected physical port, and allocate the servicesub-flow to the new physical port until the quantity of servicesub-flows on the new physical port reaches a preset quantity.
 12. Theapparatus for reducing service impairment in a LAG according to claim11, wherein: a maximum difference between a quantity of the servicesub-flows on one physical port and a quantity of the service sub-flowson another physical port is
 1. 13. The apparatus for reducing serviceimpairment in a LAG according to claim 11, wherein: a total number ofthe service sub-flows is m, a total number of the physical ports is n+1after the new physical port is added, and the preset quantity is aninteger value equal to m divided by n+1.
 14. The apparatus for reducingservice impairment in a LAG according to claim 10, wherein: theinitializing module is adapted to: divide the service packet intomultiple service sub-flows, and allocate the multiple service sub-flowsto all the physical ports averagely; and the port processing modulecomprises a deleted port processing module, adapted to allocate theservice sub-flows on the deleted physical port to other physical portsallocated by the initializing module averagely in a consecutive wayuntil the quantity of the service sub-flows on the deleted physical portis
 0. 15. The apparatus for reducing service impairment in a LAGaccording to claim 14, wherein: the maximum difference between thequantity of the service sub-flows on one physical port and the quantityof the service sub-flows on another physical port is
 1. 16. Theapparatus for reducing service impairment in a LAG according to claim12, wherein: a total number of the service sub-flows is m, a totalnumber of the physical ports is n+1 after the new physical port isadded, and the preset quantity is an integer value equal to m divided byn+1.